<?php

defined('SYSPATH') or die('No direct script access.');

class Model_Gallery extends ORM {
    protected $_table_name = 'gallery';
    protected $_db_group = 'alternate';

    protected $_table_columns = array(
        'id' => null,
        'imageFilename' => null,
        'thumbFilename' => null,
        'created' => null,
        'textData' => null,
    );

    protected $_created_column = array(
        'column' => 'created', 'format' => TRUE
    );

    public function rules() {
        return array(
            'imageFilename' => array(
                array('not_empty'),
            ),
            'thumbFilename' => array(
                array('not_empty'),
            ),
            'textData' => array(
                array('max_length', array(':value', 50)),
            )
        );
    }

    public function filters() {
        return array(
            'textData' => array(
                array('HTML::Chars'),
            ),
        );
    }

    public function labels() {
        return array(
            'imageFilename' => 'Изображение',
            'thumbFilename' => 'Превью',
            'created' => 'Загружено',
            'textData' => 'Описание',
        );
    }

}